<?php
namespace houdun\core;
class Entry{
    public static function run(){
      self::error();
      self::init();
      self::runApp();
    }
    public static function init(){
        session_id()||session_start();
        date_default_timezone_set('PRC');
    }
    public static function runApp(){
        $module=isset($_GET['m'])?$_GET['m']:'home';
        $controller=isset($_GET['c'])?$_GET['c']:'entry';
        $action=isset($_GET['a'])?$_GET['a']:'index';
        $class='app\\'.$module.'\controller\\'.ucfirst($controller);
        define('MODULE',$module);
        define('CONTROLLER',$controller);
        define('ACTION',$action);
        echo (new $class)->$action();
    }
     public static function error (){
         $whoops = new \Whoops\Run;
         $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
         $whoops->register();
     }
}